﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using LybrixNursingCRMDesktop.Landing;

namespace LybrixNursingCRMDesktop
{
    /// <summary>
    /// Interaction logic for MainPage.xaml
    /// </summary>


    public partial class MainPage : Page
    {
        public static Frame lybrixMainframe;
        #region Delegates

        public delegate void CloseLybrix();

        #endregion

        public event CloseLybrix closeEvent;
        public MainPage()
        {
            InitializeComponent();
            lybrixMainframe = MainFrame;
            LandingPage _landingPage = new LandingPage();
            MainFrame.Content = _landingPage;
        }

        private void Prospects_Click(object sender, RoutedEventArgs e)
        {
            ProspectList prospectssList = new ProspectList();
            MainFrame.Content = prospectssList;

        }

        private void ProspectsStatus_Click(object sender, RoutedEventArgs e)
        {
            // ProspectStatusList list = new ProspectStatusList(DemoDataGenerator.InitProspectStatuses(), MainFrame);
            //MainFrame.Content = list;
        }

        private void agents_Click(object sender, RoutedEventArgs e)
        {
            if (!(bool)Login.loggedUser.isSuperUser || !(bool)Login.loggedUser.isSuperUser)
            {
                MessageBox.Show("אין לך מספיק הרשאות להציג דף זה", "אזהרה", MessageBoxButton.OK);
                return;
            }
            else
            {
                agents agentsList = new agents();
                MainFrame.Content = agentsList;
            }
        }

        private void NewProspects_Click(object sender, RoutedEventArgs e)
        {
                ProspectPage newProspectPage = new ProspectPage();
                MainFrame.Content = newProspectPage;
        }

        private void Newagents_Click(object sender, RoutedEventArgs e)
        {
        
            DetailAgent newAgent = new DetailAgent();
            MainFrame.Content = newAgent;
        }

        private void previouse_Click(object sender, RoutedEventArgs e)
        {
            NextPage.IsEnabled = true;
            if (NavigationService.CanGoBack)
            {
                PreviousPage.IsEnabled = true;
                NavigationService.GoBack();
            }
            else
                PreviousPage.IsEnabled = false;
        }

        private void next_Click(object sender, RoutedEventArgs e)
        {
            PreviousPage.IsEnabled = true;
            if (NavigationService.CanGoForward)
            {
                NextPage.IsEnabled = true;
                NavigationService.GoForward();
            }
            else
                NextPage.IsEnabled = false;
        }

        private void Newsapak_Click(object sender, RoutedEventArgs e)
        {
            if (!(bool)Login.loggedUser.isSuperUser || !(bool)Login.loggedUser.isSuperUser)
            {
                MessageBox.Show("אין לך מספיק הרשאות להציג דף זה", "אזהרה", MessageBoxButton.OK);
                return;
            }
            else
            {
                SapakDetails newSapak = new SapakDetails();
                MainFrame.Content = newSapak;
            }
        }

        private void Sapakem_Click(object sender, RoutedEventArgs e)
        {
            if (!(bool)Login.loggedUser.isSuperUser || !(bool)Login.loggedUser.isSuperUser)
            {
                MessageBox.Show("אין לך מספיק הרשאות להציג דף זה", "אזהרה", MessageBoxButton.OK);
                return;
            }
            else
            {
                Sapakem Sapak = new Sapakem();
                MainFrame.Content = Sapak;
            }
        }

        private void NewBetAvot_Click(object sender, RoutedEventArgs e)
        {
            if (!(bool)Login.loggedUser.isSuperUser || !(bool)Login.loggedUser.isSuperUser)
            {
                MessageBox.Show("אין לך מספיק הרשאות להציג דף זה", "אזהרה", MessageBoxButton.OK);
                return;
            }
            else
            {
                BetAvot betAvot = new BetAvot();
                MainFrame.Content = betAvot;
            }
        }

        private void BateAvot_Click(object sender, RoutedEventArgs e)
        {
            if (!(bool)Login.loggedUser.isSuperUser || !(bool)Login.loggedUser.isSuperUser)
            {
                MessageBox.Show("אין לך מספיק הרשאות להציג דף זה", "אזהרה", MessageBoxButton.OK);
                return;
            }
            else
            {
                BateAvot bateAvot = new BateAvot();
                MainFrame.Content = bateAvot;
            }
        }

        private void HelpAbout_Click(object sender, RoutedEventArgs e)
        {
            LybrixNursingCRMDesktop.Windows.HelpAbout _helpAbout = new Windows.HelpAbout();
            _helpAbout.Show();
        }

        private void LogOut_Click(object sender, RoutedEventArgs e)
        {
            closeEvent();
        }

        private void ProspectsHistory_Click(object sender, RoutedEventArgs e)
        {
            ProspectStatusList prospectssList = new ProspectStatusList();
            MainFrame.Content = prospectssList;
        }

        private void Home_Click(object sender, RoutedEventArgs e)
        {
            LandingPage _landingPage = new LandingPage();
            MainFrame.Content = _landingPage;
        }

    }

}
